#include <iostream>
#include <vector>
#include "hw2.h"
#include <math.h>
#include <iomanip>
#include <limits>
using namespace std;

int main()
{
    int n = 10;
    Point p1(0,0,75);
    Point p2(0,0,75);
    Point p3(3,225,77);
    Point p4(3,225,77);
    Point p5(5,383,80);
    Point p6(5,383,80);
    Point p7(8,623,74);
    Point p8(8,623,74);
    Point p9(13,993,72);
    Point p10(13,993,72);
    Point points[n] = {p1,p2,p3,p4,p5,p6,p7,p8,p9,p10};
    init(points,n);
    // for (int i = 1; i < n+1; i++)
    // {
    //     double a = h_gdq(i,n+2);
    //     cout << a << endl;
        
    // }
    cout << Newton_y(10,10) << endl;
    //double eps = numeric_limits<double>::epsilon();
    double eps = 0.00001;
    double x1 = 10+eps;
    double x2 = 10-eps;
    double dy = (Newton_y(x1,10)-Newton_y(x2,10))/(x1-x2);
    cout << dy << endl;
    return 0;  
}
